home *** CD-ROM | disk | FTP | other *** search
- Path: li.net!usenet
- From: bsilvern@li.net (Bob Silvern)
- Newsgroups: comp.lang.c++
- Subject: Re: Help!!! No outport, outportb in BC++4.5 /Win32???
- Date: Mon, 15 Jan 1996 07:03:41 GMT
- Organization: Harmony Graphics
- Message-ID: <4dcu8r$2k3@linet02.li.net>
- References: <4d2g4p$8t4@newsserver.rrzn.uni-hannover.de>
- NNTP-Posting-Host: lisuser53.li.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- wulff@nwfs.rz.fh-hannover.de (Stefan Wulff) wrote:
-
- >It seems that there aren't the commands outport, outportb,... or
- >something like this in BC++4.5 for Win32.
- >But i need them.
- >Please give me an advice!
- >Thanks.
- >Stefan.
-
- I too found that pretty anoying. I wrote these macros to ease the 16 to 32 bit
- transition. They help, but use them cautiously because the directly manipulate
- the AX and DX registers. The compiler won't realize your doing this, so it is
- posible that the compiler will try to use the value of these registers after
- you trash them. You can fix this by starting each of the macros below with
- "push _AX; push _DX;" and ending each one with "pop _DX; pop _AX;" if execution
- time isn't critical and you want to be safe. Mine was a real time application
- so I had to live dangerously.
-
- #ifdef WIN32
- #define MK_FP(a, b) (((a) << 16) + (b))
- #define outportb(p, d) {_DX = p; _AL = d; asm out dx,al;}
- #define outport(p, d) {_DX = p; _AX = d; asm out dx,ax;}
- #define inportb(p, d) {_DX = p; asm in al,dx; d = _AL;}
- #define inport(p, d) {_DX = p; asm in ax,dx; d = _AX;}
- #endif
-
-
-